PROJECT=vm1

OPTIMIZATION=-o3  -msse
DIRS_INCLUDE=-Iinclude

DIRS_LIB_STATIC=-Llib/static
DIRS_LIB_DYNAMIC=-Iinclude -Llib/dynamic

DIRS_LIB=$(DIRS_LIB_DYNAMIC) $(DIRS_LIB_STATIC)

LIBS_BOOST_STATIC=#-lboost_thread
LIBS_BOOST_DYNAMIC=#-lboost_thread.so
LIBS_MISC=-lpthread
MISC_OPTIONS=

WARNING_OPTIONS=-Wall

DEBUG_OPTIONS=    -g $(DIRS_INCLUDE)                 $(WARNING_OPTIONS)  $(MISC_OPTIONS)
#RELEASE_OPTIONS=    $(DIRS_INCLUDE)                 $(WARNING_OPTIONS)  $(MISC_OPTIONS)
RELEASE_OPTIONS=     $(DIRS_INCLUDE) $(OPTIMIZATION) $(WARNING_OPTIONS)  $(MISC_OPTIONS)

CC=mpicc
############################################################################
All: 1a 1b
# ===========================================
obj/1a/main.o: src/gvozdarev_1a.c
	$(CC)  -c  $(RELEASE_OPTIONS)   src/gvozdarev_1a.c                 -o obj/1a/main.o

1a:  obj/1a/main.o
	$(CC)     $(RELEASE_OPTIONS)  $(DIRS_LIB)     obj/1a/*.o                      -o  bin/1a

# ------------------------------
obj/1b/main.o: src/gvozdarev_1b.c
	$(CC)  -c  $(RELEASE_OPTIONS)   src/gvozdarev_1b.c                 -o obj/1b/main.o

1b:  obj/1b/main.o
	$(CC)     $(RELEASE_OPTIONS)  $(DIRS_LIB)     obj/1b/*.o                      -o  bin/1b
# ===========================================
Test: Init All test_1a test_1b

# ------------------------------
test_1a:
	perl test_1a.pl --from 1 --to 150000 --step 4
# ------------------------------
test_1b:
	perl test_1b.pl --proc_num 16 --mess_num 10000

# ===========================================
Clean:
	rm -rf bin/*
	rm -rf obj/*
	rm -rf stats/*
# -----------------------------
Init: Clean
	mkdir -p bin/
	mkdir -p obj/1a
	mkdir -p obj/1b
	mkdir -p stats/
#	link simple_matrix.txt bin/Release/matrix.txt
#	link simple_data.txt bin/vm2/data.txt
#	link config.json bin/Release/config.json
#	link config.json bin/Debug/config.json
############################################################################
